/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.commands;

import com.hercules.android.receiver.util.evaluators.PathEvaluator;

/**
 * This is abstract class that aggregates target related fields (targetId, targetPath and pathEvalutor). According to
 * XRE protocol specification, this command is used for calling methods of XRE objects. It is a simple JavaBean (POJO)
 * that provides getters and setters for all private attributes and performs no argument validation in the setters.
 * <p>
 * AndroidAssembly1 this class was added in Android Assembly 1
 * <p>
 * <strong>Thread safety:</strong> This class is mutable and not thread safe.
 * </p>
 *
 * @author 7realm
 * @version 1.0
 */
public abstract class XRETargetCommand extends XRECommand {
    /**
     * The host-assigned ID of the object on which to call the method.
     * <p>
     * Should be ignored when targetPath is not null.
     * <p>
     * Can be any value. Has getter and setter.
     */
    private int targetId;

    /**
     * The host-assigned DOM path of the object on which to call the method.
     * <p>
     * If null, targetId is used instead.
     * <p>
     * Can be any value. Has getter and setter.
     */
    private String targetPath;

    /**
     * Path evaluator, that will be used to evaluate targetPath to get targetId.
     * <p>
     * Can be any value. Has getter and setter.
     * <p>
     * AndroidAssembly1: This field and corresponding getter and setter were added.
     */
    private PathEvaluator pathEvaluator;

    /**
     * Creates new instance of {@link XRETargetCommand} class.
     */
    protected XRETargetCommand() {
        // empty constructor
    }

    /**
     * Retrieves the host-assigned ID of the object on which to call the method.
     *
     * @return the host-assigned ID of the object on which to call the method
     */
    public int getTargetId() {
        return targetId;
    }

    /**
     * Sets the host-assigned ID of the object on which to call the method.
     *
     * @param targetId the host-assigned ID of the object on which to call the method
     */
    public void setTargetId(int targetId) {
        this.targetId = targetId;
    }

    /**
     * Retrieves the host-assigned DOM path of the object on which to call the method.
     *
     * @return the host-assigned DOM path of the object on which to call the method
     */
    public String getTargetPath() {
        return targetPath;
    }

    /**
     * Sets the host-assigned DOM path of the object on which to call the method.
     *
     * @param targetPath the host-assigned DOM path of the object on which to call the method
     */
    public void setTargetPath(String targetPath) {
        this.targetPath = targetPath;
    }

    /**
     * Gets the path evaluator, that will be used to evaluate targetPath to get targetId.
     *
     * @return the path evaluator, that will be used to evaluate targetPath to get targetId
     */
    public PathEvaluator getPathEvaluator() {
        return pathEvaluator;
    }

    /**
     * Sets the path evaluator, that will be used to evaluate targetPath to get targetId.
     *
     * @param pathEvaluator the path evaluator, that will be used to evaluate targetPath to get targetId
     */
    public void setPathEvaluator(PathEvaluator pathEvaluator) {
        this.pathEvaluator = pathEvaluator;
    }
}
